package com.lottery.ruok.lottrey.chat.model.redpacket.message.sendRedPacketMessage;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.text.Spannable;
import android.text.SpannableString;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.applozic.mobicomkit.ChatConfig;
import com.lottery.ruok.lottrey.R;
import com.lottery.ruok.lottrey.activity.GetPacketResultActivity;
import com.lottery.ruok.lottrey.activity.LoginActivity;
import com.lottery.ruok.lottrey.chat.RongCloudChatManager;
import com.lottery.ruok.lottrey.chat.model.redpacket.message.receiveRedPacketMessage.ReceiveRedPacketMessage;
import com.lottery.ruok.lottrey.chat.model.redpacket.message.sendRedPacketMessage.view.RedPacketView;
import com.lottery.ruok.lottrey.common.Common;
import com.lottery.ruok.lottrey.dialog.RedPacketAniDialog;
import com.lottery.ruok.lottrey.eventbusObject.GrabRedPacketSucess;
import com.lottery.ruok.lottrey.retrofitModule.RetrofitBase;
import com.lottery.ruok.lottrey.retrofitModule.RxHelper;
import com.lottery.ruok.lottrey.retrofitModule.RxSubscribe;
import com.lottery.ruok.lottrey.retrofitModule.request.GrabGiftRequest;
import com.lottery.ruok.lottrey.retrofitModule.response.GrabGiftResponse;

import org.greenrobot.eventbus.EventBus;

import io.rong.imkit.model.ProviderTag;
import io.rong.imkit.model.UIMessage;
import io.rong.imkit.userInfoCache.RongUserInfoManager;
import io.rong.imkit.widget.provider.IContainerItemProvider;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.UserInfo;
import utils.StringUtils;

/**
 * Created by Beyond on 2016/12/5.
 */

@ProviderTag(messageContent = RedPacketMessage.class, showProgress = false, showReadState = true)
public class RedPacketMessageItemProvider extends IContainerItemProvider.MessageProvider<RedPacketMessage> {
    private final static String TAG = "ContactMessageItemProvider";
private Context context;





    public RedPacketMessageItemProvider() {
    }

    @Override
    public View newView(Context context, ViewGroup group) {
        RedPacketView redPacketView = new RedPacketView(context);
        this.context=context;
        return redPacketView;
    }

    @Override
    public void bindView(View v, int position, final RedPacketMessage content, final UIMessage message) {
        if (v instanceof RedPacketView) {
            RedPacketView view = (RedPacketView) v;
            view.setData(content);
            if (message.getMessageDirection() == Message.MessageDirection.RECEIVE) {
                view.setRedPacketBackgroundResource(R.drawable.left_red_packet);
            } else {
                view.setRedPacketBackgroundResource(R.drawable.right_red_packet);
            }
        }
    }

    @Override
    public Spannable getContentSummary(final RedPacketMessage RedPacketMessage) {
        return null;
    }

    @Override
    public Spannable getContentSummary(Context context, final RedPacketMessage RedPacketMessage) {
        return new SpannableString("[ 红包 ]");
    }

    @Override
    public void onItemClick(View view, int position, final RedPacketMessage content, final UIMessage message) {



    }


}
